import request from '@/utils/request'

// 登录接口
export function login(username, password) {
  // 登录接口
  return request({
    url: '/admin/index/login',
    method: 'post',
    data: {
      username,
      password
    }
  })
}

// 获得用户信息
export function getInfo(token = '') {
  return request({
    url: '/admin/manager/profile',
    method: 'get',
    params: { }
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/admin/index/logout',
    method: 'post'
  })
}

// 修改用户信息
export function update(mobile, realname, nickname, email, face, password) {
  return request({
    url: '/admin/manager/update',
    method: 'post',
    data: {
      mobile,
      realname,
      nickname,
      email,
      face,
      password
    }
  })
}

// 列表
export function search(query) {
  return request({
    url: '/admin/user/search',
    method: 'get',
    params: query
  })
}
export function editUser(data) {
  return request({
    url: '/admin/user/edit',
    method: 'post',
    data: data
  })
}
// 列表
export function userScore(query) {
  return request({
    url: '/admin/userScore/search',
    method: 'get',
    params: query
  })
}
// 删除
export function del(ids) {
  return request({
    url: '/admin/enterprise/del',
    method: 'post',
    data: { ids
    }
  })
}
